package ty.pub;

import java.io.Serializable;



public class Error implements Serializable{

	public static enum ExceptionType{
		RUN_TIME, //运行时异常
		CHECK_FAIL, //校验失败
		TREAT_MISSING, //处理方案不存在
		ITEM_MISSING, // 资源查找失败
		TREAT_ERROR, // 处理算法错误
		DEVICE_MISSING, // 设备查找失败
		UN_KNOWN //未知异常
	}

	public static enum ExceptionNode{
		PROROCOL_RECOG, //协议识别
		PARSE, //解析
		DEVICE_RECOG, //设备识别
		TRANS, //转换
		DATA_STORE //存储
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6314165727053965512L;
	
	private String rawDataId;
	
	private short exceptionType;
	
	private short exceptionNode;
	
	private boolean isThrowed = false;

	public String getRawDataId() {
		return rawDataId;
	}

	public void setRawDataId(String rawDataId) {
		this.rawDataId = rawDataId;
	}

	public ExceptionType getExceptionType() {
		return ExceptionType.values()[exceptionType];
	}

	public void setExceptionType(ExceptionType exceptionType) {
		this.exceptionType = (short) exceptionType.ordinal();
	}

	public ExceptionNode getExceptionNode() {
		return ExceptionNode.values()[exceptionNode];
	}

	public void setExceptionNode(ExceptionNode node) {
		this.exceptionNode = (short) node.ordinal();
	}

	public boolean isThrowed() {
		return isThrowed;
	}

	public void setThrowed(boolean isThrowed) {
		this.isThrowed = isThrowed;
	}

	public Error(){
		
	}
	
	public Error(String rawDataId, ExceptionType exceptionType, ExceptionNode exceptionNode, boolean isThrowed) {
		super();
		this.rawDataId = rawDataId;
		this.exceptionType = (short) exceptionType.ordinal();
		this.exceptionNode = (short) exceptionNode.ordinal();
		this.isThrowed = isThrowed;
	}
	
	public Error(ExceptionType exceptionType, ExceptionNode exceptionNode) {
		super();
		this.exceptionType = (short) exceptionType.ordinal();
		this.exceptionNode = (short) exceptionNode.ordinal();
	}

}
